-- GENERATED SPELL FOR [Death Knight Cavalier] --


function spell0_16163(pUnit, Event) --@Bone Armor,Self--
pUnit:FullCastSpellOnTarget(55315,pUnit)
pUnit:RegisterEvent('Sorts_16163', 582, 1)
end

function spell1_16163(pUnit, Event) --@Bone Armor,Self--
pUnit:FullCastSpellOnTarget(55336,pUnit)
pUnit:RegisterEvent('Sorts_16163', 540, 1)
end

function spell2_16163(pUnit, Event) --@Dismount Deathcharger,n/a--
if charge_disp ~= 'na' then
pUnit:FullCastSpellOnTarget(55294,pUnit:GetMainTank ())
local charge_disp = 'na'
end
pUnit:RegisterEvent('Sorts_16163', 1, 1)
end

function spell3_16163(pUnit, Event) --@Icy Touch,n/a--
pUnit:FullCastSpellOnTarget(55313,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_16163', 8311, 1)
end

function spell4_16163(pUnit, Event) --@Icy Touch,n/a--
pUnit:FullCastSpellOnTarget(55331,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_16163', 8339, 1)
end

function spell5_16163(pUnit, Event) --@Strangulate,n/a--
pUnit:FullCastSpellOnTarget(55314,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_16163', 5000, 1)
end

function spell6_16163(pUnit, Event) --@Strangulate,n/a--
pUnit:FullCastSpellOnTarget(55334,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_16163', 5000, 1)
end

function Sorts_16163(pUnit, Event)
local choix_sorts_16163 = math.random(0, 6)
if choix_sorts_16163 == 0 then
pUnit:RegisterEvent('spell0_16163', 1, 1)
end
if choix_sorts_16163 == 1 then
pUnit:RegisterEvent('spell1_16163', 1, 1)
end
if choix_sorts_16163 == 2 then
pUnit:RegisterEvent('spell2_16163', 1, 1)
end
if choix_sorts_16163 == 3 then
pUnit:RegisterEvent('spell3_16163', 1, 1)
end
if choix_sorts_16163 == 4 then
pUnit:RegisterEvent('spell4_16163', 1, 1)
end
if choix_sorts_16163 == 5 then
pUnit:RegisterEvent('spell5_16163', 1, 1)
end
if choix_sorts_16163 == 6 then
pUnit:RegisterEvent('spell6_16163', 1, 1)
end
end

function mob16163_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_16163', math.random(1500, 3000), 1)
end

function mob16163_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob16163_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob16163_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(16163, 1, 'mob16163_Action')
RegisterUnitEvent(16163, 2, 'mob16163_Leave')
RegisterUnitEvent(16163, 3, 'mob16163_Kill')
RegisterUnitEvent(16163, 4, 'mob16163_Die')
